FROM devilbox/php-fpm:5.3-mods

RUN echo "Asia/Shanghai" > /etc/timezone && \
    /bin/cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

RUN set -x \
	&& DEBIAN_FRONTEND=noninteractive apt-get update -qq \
	&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests apt-utils \
	&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests \
		${BUILD_DEPS} \
# ---- Installing PHP Extension: ioncube ----
    && pecl install yaf-2.2.9 \
	&& docker-php-ext-enable yaf \
	&& (rm -rf /usr/local/lib/php/test/yaf || true) \
	&& (rm -rf /usr/local/lib/php/doc/yaf || true) \
	&& rm -rf /tmp/* \
	\
	&& DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false ${BUILD_DEPS} \
	&& DEBIAN_FRONTEND=noninteractive apt-get install -qq -y --no-install-recommends --no-install-suggests ${RUN_DEPS} \
	&& DEBIAN_FRONTEND=noninteractive apt-get purge -qq -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false apt-utils \
	&& rm -rf /var/lib/apt/lists/*

RUN sed -i '$a\yaf.use_namespace=1' /usr/local/etc/php/conf.d/docker-php-ext-yaf.ini; \
	sed -i '$a\yaf.environ=develop' /usr/local/etc/php/conf.d/docker-php-ext-yaf.ini
# SCWS
    curl -SL "http://www.xunsearch.com/scws/down/scws-1.2.2.tar.bz2" -o SCWS.tar.bz2; \
    mkdir -p SCWS; \
    tar -xf SCWS.tar.bz2 -C SCWS --strip-components=1; \
    rm SCWS.tar.bz2; \
    ( \
        cd SCWS; \
		./configure; \
		make install; \
		cd phpext; \
		phpize; \
		./configure --with-scws=/usr/local; \
        make -j$(nproc) ; \
        make install \
    ); \
    rm -r SCWS; \
# COPY zend.conf /usr/local/etc/php-fpm.d/zend.conf
# COPY include/. /usr/local/php/share/pear